/*
 * Author: Alvin
 * Modified By: Alvin
 * Created Date: 2023-06-03 17:02:00
 * Last Modified: 2023-06-05 10:18:31
 * Description:
 */
import 'package:json_annotation/json_annotation.dart';

/// 默认每页数据数量
const int defatultPageSize = 10;

/// 默认初始页码
const int defaultPage = 1;

enum PageRequestType {
  refresh,
  refreshFailed,
  load,
  loadFailed,
}

@JsonEnum(valueField: "order")
enum ListSortType {
  ascend(order: "ascend"),
  descend(order: "descend");

  final String order;

  const ListSortType({required this.order});

  factory ListSortType.from(String order) {
    switch (order) {
      case "descend":
        return ListSortType.descend;
      default:
        return ListSortType.ascend;
    }
  }

  @override
  String toString() {
    switch (this) {
      case ListSortType.descend:
        return "descend";
      default:
        return "ascend";
    }
  }
}
